import { _decorator, Component, Node, tween, Vec2, Vec3 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('movementControl')
export class movementControl extends Component {
    start() {
       
    // 创建动作
    // const srcTween = tween(this.node)
    // .to(1.0, { position: new Vec3(200, 200, 0)})       
    
    // // to 动作完成后会调用该方法     
    // .call( ()=>{
    //     console.log("call");
    // })
    // .start()
    let jumpHeight = 100; // 跳跃高度
let jumpDuration = 1; // 跳跃持续时间
let jumpCount = 1; // 跳跃次数
let moveDistance = new Vec3(200, 0); // 水平移动距离
    tween(this.node)
    .to(jumpDuration / 2, { position: new Vec3(this.node.position.x + moveDistance.x / 2, this.node.position.y + jumpHeight) })
    .to(jumpDuration / 2, { position: new Vec3(this.node.position.x + moveDistance.x, this.node.position.y) })
    .repeat(jumpCount)
    .start();

    
    }

    update(deltaTime: number) {
        
    }
}


